copyObject not working correctly?

If I'm using this code:

//Method to create the find method, which finds the objects which have been modified between the selected dates
void find(Date a, Date b)
{
    //Declares "Date" variable "p"
        Date p  
        //Declares a true/false (boolean) variable "lessThan"
        bool lessThan
        
        //loops through all objects in the current module
        print a
        print b
        l = current
        for o in l do
        {
                //tests to see if the "Last Modified On" attribute is between a and b, the selected dates
                p = o."Last Modified On"
                lessThan = false
                if(a <= p)
                {
                        lessThan = true
                        if(b >= p)
                        {
                                lessThan = true
                        }
                        else
                        {
                                lessThan = false
                        }
                }
                else
                {
                        lessThan = false
                }
                if(lessThan)
                {
                        //add the object to the new module "m"
                        copyObject(o, o, m)
                }
        }
}                                                                                    //End of the "find" method

 


Shouldn't this use the "copyObject" function (I copied copyObj.idx into my file so that I can use copyObject) to copy object o from module l and paste it into the new module m if lessThan is true? For some reason, the only issue I'm having with my code is with the copyObject fuction, and I can't figure out how to get around it.
Thanks!

 


josiah820 - Wed Jun 06 10:35:22 EDT 2012

Re: copyObject not working correctly?
llandale - Wed Jun 06 17:01:10 EDT 2012

Is variable "l" a "Module", an "Object", a "Trigger", a "Project", or what? Looks like its either a "Module" or "Object" since the next line of code works. DECLARE YOUR VARIABLES

Don't know about the copyObject() function, but it looks odd that you use the same parameter "o". Does not the other object in "m" have its own handle? Is the 2nd parameter the "m" object after which you create a new one?

Perhaps explain "issue".

-Louie

Re: copyObject not working correctly?
llandale - Wed Jun 06 17:14:52 EDT 2012

llandale - Wed Jun 06 17:01:10 EDT 2012
Is variable "l" a "Module", an "Object", a "Trigger", a "Project", or what? Looks like its either a "Module" or "Object" since the next line of code works. DECLARE YOUR VARIABLES

Don't know about the copyObject() function, but it looks odd that you use the same parameter "o". Does not the other object in "m" have its own handle? Is the 2nd parameter the "m" object after which you create a new one?

Perhaps explain "issue".

-Louie

Do yourself a favor, lookup "Auto-declare" in the DXL manual and turn it off.